#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.68)
AC_INIT([guile-gcc], 0.0, [guile-user@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])

AM_INIT_AUTOMAKE([1.11 foreign silent-rules subdir-objects \
 color-tests parallel-tests])

AC_CONFIG_SRCDIR([src/guile.c])
AC_CONFIG_HEADER([config.h src/ggcc-config.h])
AC_CONFIG_MACRO_DIR([m4])

AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
LT_INIT([disable-static])

GGCC_GCC_PLUGIN_SUPPORT
if test "x$ac_cv_have_gcc_plugins" != "xyes"; then
   AC_MSG_ERROR([GCC plug-in support is lacking])
fi

GGCC_GCC_VERSION
gccplugindir="\${pkglibdir}/${GGCC_GCC_VERSION_MAJOR}.${GGCC_GCC_VERSION_MINOR}"
AC_SUBST([gccplugindir])

guilemoduledir="${datarootdir}/guile/site/2.0"
AC_SUBST([guilemoduledir])

# Force $prefix to be a valid directory.
test "x$prefix" = xNONE && prefix=$ac_default_prefix
AC_DEFINE_UNQUOTED([GGCC_MODULE_DIRECTORY], ["`eval "echo $guilemoduledir"`"],
  [Directory where Guile-GCC's Scheme files are installed.])

PKG_CHECK_MODULES([GUILE], [guile-2.0])
AC_PATH_PROG([GUILE], [guile])
AC_PATH_PROG([GUILE_SNARF], [guile-snarf])

AC_CONFIG_FILES([Makefile
                 tests/run-test])

AC_CONFIG_COMMANDS([executable-script], [chmod +x tests/run-test])

AC_OUTPUT
